package com.pingba.dao.friend;

import com.pingba.dao.BaseDao;
import com.pingba.entity.friend.FriendApply;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Administrator on 2015/11/9 0009.
 */
@Repository
public interface FriendApplyDao extends BaseDao<FriendApply,Long> {

    List<FriendApply> getMyApplySendHistory(long userId);

    List<FriendApply> getMyUnhandled(long userId);

    List<FriendApply> getMyApplyRcvHistory(long userId);

    void setHandled(long fromUserId, long toUserId);

    /**
     * 将所有对该用户的请求设置为已处理
     * @param toUserId
     */
    void setAllHandled(long toUserId);


    /**
     * 更新用户的动作，同意或者拒绝
     * @param fromUserId
     * @param toUserId
     * @param status
     */
    void updateStatus(long fromUserId, long toUserId, int status);

    /**
     * 通过fromUserId和toUserId来查找有没有一个用户
     * @param apply
     * @return
     */
    FriendApply find(FriendApply apply);
}
